import type { PlusColumn } from 'plus-pro-components'

export function useForm() {
    const schema: PlusColumn[] = [
        {
            colProps: {
                span: 6,
            },
            label: '订单编号',
            prop: 'orderNo',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            label: '订单名称',
            prop: 'orderName',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            label: '乙方',
            prop: 'partyB',
            valueType: 'copy',
        },
        {
            colProps: {
                span: 6,
            },
            fieldProps: {
                'endPlaceholder': '请选择结束时间',
                'startPlaceholder': '请选择开始时间',
                'type': 'daterange',
                'value-format': 'YYYY-MM-DD',
            },
            label: '下单时间',
            prop: 'selectTime',
            valueType: 'date-picker',
        },
        {
            colProps: {
                span: 6,
            },
            label: '合同名称',
            prop: 'agreementName',
            valueType: 'copy',
        },
    ] as const

    const state = {
        agreementName: '',
        orderName: '',
        orderNo: '',
        partyB: '',
        selectTime: [],
    }
    const form = ref({
        ...state,
    })

    function reset() {
        form.value = {
            ...state,
        }
    }

    return { form, reset, schema, state }
}
